# -*- coding: utf-8 -*-
"""
@Time ： 2023/1/1 15:43
@Auth ： jiraWu
@File ：requests_post请求.py
@IDE ：PyCharm
@Motto:人生苦短，我学Python

"""

import requests

url = "https://fanyi.baidu.com/v2transapi?from=zh&to=en"
data = {
    'from':
        'zh',
    'to':
        'en',
    'query':
        '你好',
    'transtype':
        'realtime',
    'simple_means_flag':
        '3',
    'sign':
        '833493.546020',
    'token':
        'ab651b6fd29ccef29daf97a984f5bf4b',
    'domain':
        'common'
}
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    ,
    "cookie": "BIDUPSID=B57B32E6C59F55EDF52BBB2A52D097F3; PSTM=1654247182; BAIDUID=B57B32E6C59F55EDABB894F9521AB43C:FG=1; REALTIME_TRANS_SWITCH=1; SOUND_SPD_SWITCH=1; HISTORY_SWITCH=1; FANYI_WORD_SWITCH=1; SOUND_PREFER_SWITCH=1; APPGUIDE_10_0_2=1; BDSFRCVID=0_POJexroG0wKK3j4jhd-_t6-gKK0gOTDYLEOwXPsp3LGJLVgrUBEG0Pt_U-mEt-J8jwogKK3gOTH4DF_2uxOjjg8UtVJeC6EG0Ptf8g0M5; H_BDCLCKID_SF=JnAfoKK2fIt3qJTph47hqR-8MxrK2JT3KC_X3b7Ef-O_Kq7_bf--Dx_ALJ5vJ-Tx-GRJsx72Jj6JOnnn3bjxy5K_hpQ73R5B3b6NBJOM5JTOeJTHQT3m3UrbbN3i-xr2MIv3Wb3cWKOJ8UbS253PBTD02-nBat-OQ6npaJ5nJq5nhMJmb67JD-50eGK8t5LHtbPjV-582R7_KJO1MtbOq4IOqxby26PHa-j9aJ5nJD_MhIn25TJ8j-IS2mcd-TKLQgrX_nbmQpP-HJ7gh4RpMUvQ3f-fX45rJNvhKl0MLU3Ybb0xyUQDMf73WxnMBMPe52OnaIbg3fAKftnOM46JehL3346-35543bRTLnLy5KJtMDFRjTLhj5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m; H_PS_PSSID=26350; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; Hm_lvt_64ecd82404c51e03dc91cb9e8c025574=1669984251,1672034547,1672559212; Hm_lpvt_64ecd82404c51e03dc91cb9e8c025574=1672560205; ab_sr=1.0.1_NTlmNGE1YWI5MjZiOGE1OGU5ZTIwYzYxNWExY2MyODI1ODllNGEzNDljZTAzNDY4MDg2YWUzMDZjOTc5MTJmMTQxOGYwZTA1Y2VmMmYwMTA0YzMwNmYyYTMyZjg4ODMyMzRjMjgzNDRiMzk5MjcwYWNhYmVhZWZiNDg3MTk4N2JhY2UyMjM0ZThjOWNjZTFhZWE2MjVjZTM0ZWE5MmYyOA=="
}

"""
url 请求地址
data 请求参数
kwargs 字典
"""
resp = requests.post(url=url, data=data, headers=headers)
import json

obj = json.loads(resp.text)
print(obj)
